OnNavigateListener

The listener interface for receiving "onNavigate" events, typically generated by components that handle web content rendering, such as an embedded WebView (e.g., within a WEB module).

A class interested in processing and potentially intercepting these navigation events implements this interface. The listener object is then registered with the relevant component (e.g., using an addOnNavigateListener method on a web view component).

This listener is primarily responsible for allowing external code to inspect and control URL navigation requests *before* the actual loading of the web resource occurs. Common use cases include:

  • URL filtering or whitelisting/blacklisting.
  • Redirecting certain URLs to different destinations.
  • Logging navigation attempts for analytics or security.
  • Injecting headers or modifying the request before it's sent (if supported by the underlying component).
  • Displaying custom messages or dialogs before allowing/denying navigation.

Functions

Link copied to clipboard
abstract fun onNavigate(url: String): Boolean
* Called just before a component attempts to navigate to the supplied URL.